/*
 * //******************************************************************
 * //
 * // Copyright 2016 Samsung Electronics All Rights Reserved.
 * //
 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 * //
 * // Licensed under the Apache License, Version 2.0 (the "License");
 * // you may not use this file except in compliance with the License.
 * // You may obtain a copy of the License at
 * //
 * //      http://www.apache.org/licenses/LICENSE-2.0
 * //
 * // Unless required by applicable law or agreed to in writing, software
 * // distributed under the License is distributed on an "AS IS" BASIS,
 * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * // See the License for the specific language governing permissions and
 * // limitations under the License.
 * //
 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 */
package org.iotivity.cloud.base.protocols.enums;

import java.util.Arrays;
import java.util.List;

public enum ResponseStatus {
    // Empty response
    EMPTY,
    // Success 2.xx
    CREATED, DELETED, VALID, CHANGED, CONTENT,
    // Client Error 4.xx
    BAD_REQUEST, UNAUTHORIZED, BAD_OPTION, FORBIDDEN,
    //
    NOT_FOUND, METHOD_NOT_ALLOWED, NOT_ACCEPTABLE,
    //
    PRECONDITION_FAILED, REQUEST_ENTITY_TOO_LARGE,
    //
    UNSUPPORTED_CONTENT_FORMAT,
    // Server Error 5.xx
    INTERNAL_SERVER_ERROR, NOT_IMPLEMENTED, BAD_GATEWAY,
    //
    SERVICE_UNAVAILABLE, GATEWAY_TIMEOUT, PROXY_NOT_SUPPORTED;

    private static final List<ResponseStatus> successResponseStatuses = Arrays.asList(ResponseStatus.CREATED, ResponseStatus.DELETED, ResponseStatus.VALID, ResponseStatus.CHANGED, ResponseStatus.CONTENT);

    public boolean isSuccess() {
        return successResponseStatuses.contains(this);
    }
}
